home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / lzwlib / lzw.src < prev    next >
Text File  |  1992-03-16  |  5KB  |  159 lines

  1. !--------------------------------------------------------------------------
  2. *lsz_init
  3. lzw_init()                                                         LZW Beta
  4.  
  5. Initializes the LZW library
  6.  
  7. #include <lzw.h>
  8.  
  9. \3void lzw_init();\3
  10.  
  11. \1Returns\1       None
  12.  
  13. \1Description\1   
  14.  
  15. This routine initializes certain globalal variables
  16. functions.
  17.  
  18. \1Cautions\1
  19.  
  20. This function MUST be called before calling any other LZW library 
  21. functions.
  22.  
  23. \1Related Functions\1
  24.  
  25. \2lzw_deinit()\2
  26. !--------------------------------------------------------------------------
  27. *lzw_deinit
  28. lzw_deinit()                                                       LZW Beta
  29.  
  30. Deinitializes the LZW library
  31.  
  32. #include <lzw.h>
  33.  
  34. \3void lzw_deinit();\3
  35.  
  36. \1Returns\1        None
  37.  
  38. \1Description\1
  39.  
  40. This function clears the linked list.
  41.  
  42. \1Cautions\1
  43.  
  44. This functions must only be called after a call to lzw_init()
  45.  
  46. \1Related Functions\1
  47.  
  48. \2lzw_init()\2
  49. !--------------------------------------------------------------------------
  50. *lzw()
  51. lzw()                                                              LZW Beta
  52.  
  53. Compresses file(s) into an LZW file
  54.  
  55. #include <lzw.h>
  56.  
  57. \3int lzw(char *lzw_pathfile, unsigned long ops, char *infile_pathmask);\3
  58.  
  59. \1Returns\1      0  Success
  60.             -1  Could not open or create LZW file
  61.             -2  Not an appropriate LZW file 
  62.             -3  Could not read in file directory (linked list)
  63.             -4  Nothing to do.  _dos_findfirst on mask unsuccessful
  64.             -5  Could not open input file
  65.             -6  Encoding error
  66.             -7  Could not save file directory (linked list)
  67.  
  68. \1Description\1
  69.  
  70. This function acts on the \3lzw_pathfile\3 to perform the specified \3ops\3:
  71.  
  72.  PATHNAMES - May be used to insert the entire pathname of the file 
  73.              into the LZW header.
  74.  
  75. The \3infile_pathmask\3 parameter is the mask of files that are to be 
  76. compressed and may include a valid DOS path.
  77.  
  78. A pass is made through the entire .LZW file, skipping from header to 
  79. header, for each file to be compressed.  If that file already exists, 
  80. the header structure member 'marked' is filled with the '*' character,
  81. then the new file is appended to the end of the file.  This can
  82. cause the .LZW file to grow fairly rapidly in size because the
  83. old files are not automatically purged.  The lzwpurge() function
  84. may be used to physically purge all marked files.
  85.  
  86. \1Related Functions\1
  87.  
  88. \2unlzw(), lzwpurge()\2
  89. !--------------------------------------------------------------------------
  90. *unlzw()
  91. unlzw()                                                            LZW Beta
  92.  
  93. Expands file(s) from an LZW file
  94.  
  95. #include <lzw.h>
  96.  
  97. \3int unlzw(char *lzw_pathfile, unsigned long ops, char *mask);\3
  98.  
  99. \1Returns\1         0  Success
  100.                -1  Could not open LZW file
  101.                -2  LZW file is empty or corrupted
  102.                -3  Not an LZW file
  103.                -4  Could not load file directory (linked list)
  104.                -5  Could not create output file
  105.                -6  Decoding error    
  106.                -7  Could not save file directory (linked list);
  107.  
  108. \1Description\1
  109.  
  110. This function acts on the \3lzw_pathfile\3 to perform the specified \3ops\3:
  111.  
  112.  EXTRACT     - Extracts the files designated by the parameter mask.
  113.  VIEW        - Not currently implemented, but will allow the passing 
  114.                of a function pointer to give the programmer access
  115.                to file information designated by the parameter mask.
  116.                Cannot be used in conjunction with any other operation.
  117.  CREATEDIRS  - Can be used in conjunction with the EXTRACT operation to 
  118.                create the directory specified in the path structure
  119.                member, if such a path exists.
  120.  NOOVERWRITE - Can be used in conjunction with EXTRACT &| CREATEDIRS
  121.                so existing files will not be overwritten.  Otherwise,
  122.                they will be.
  123.  
  124. Only files matching the \3mask\3 parameter will be extracted.
  125.  
  126. \1Caution\1
  127.  
  128. Ops may be or'd together for this call, except that the VIEW option 
  129. MAY NOT be used in conjunction with any other call.
  130.  
  131. \1Related Functions\1
  132.  
  133. \2lzw()\2
  134. !--------------------------------------------------------------------------
  135. *lzwpurge()
  136. lzwpurge()                                                         LZW Beta
  137.  
  138. Purges marked and specified files from an LZW file
  139.  
  140. #include <lzw.h>
  141.  
  142. \3int lzwpurge(char *lzw_pathfile,char *mask);\3
  143.  
  144. \1Returns\1      0  Success
  145.             -1  Could not LZW file
  146.             -2  Not an appropriate LZW file 
  147.             -3  Could not open temporary file
  148.  
  149. \1Description\1
  150.  
  151. This call will purge all 'marked' files from \3lzw_pathfile\3.  Specifiying a 
  152. mask will also cause files matching the \3mask\3 to be purged even if they have 
  153. not been previously marked.  Pass NULL in the mask parameter position if
  154. no additional files are to be purged.
  155.  
  156. \1Related functions\1
  157.  
  158. \2lzw()\2
  159.